package com.baeldung.bidirect;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

/**
 * Created by dzy on 2018/9/2
 */
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
public class ItemWithIdentity {
  public int id;
  public String itemName;
  public UserWithIdentity owner;

  public ItemWithIdentity() {
    super();
  }

  public ItemWithIdentity(final int id, final String itemName, final UserWithIdentity owner) {
    this.id = id;
    this.itemName = itemName;
    this.owner = owner;
  }

  @Override
  public String toString() {
    return "ItemWithIdentity{" +
      "id=" + id +
      ", itemName='" + itemName + '\'' +
      ", owner=" + owner +
      '}';
  }
}
